/*
 * @Author: your name
 * @Date: 2022-01-04 16:20:19
 * @LastEditTime: 2022-01-04 16:22:27
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /c++第13天设计文字游戏项目实战/save_game.cpp
 */

#include <iostream>
extern"C"
{
#include <stdio.h>
#include <string.h>
}
using namespace std;

int main()
{
        
         
       FILE *fp=fopen("save_game.txt","r+");
            if(fp == NULL)
            {
                cerr << "打开文件失败" << endl;  
            }

        //读取文件中的数据 
        char buf[1024]={0}; 
        fread(buf,1,1024,fp);

       //输出信息
       cout <<  buf << endl; 

        //写入信息  
        char w_buf[1024]={"肉蛋冲击  40   20  20  20"}; 
        fwrite(w_buf,1,strlen(w_buf),fp);
        //关闭文件
        fclose(fp);

};